{% extends 'base.html' %}

{% block content %}
<div class="container mt-4">
    <div class="d-flex justify-content-between mb-3">
        <h2><i class="fas fa-cat"></i> 猫咪信息管理</h2>
        <a href="{% url 'cat_create' %}" class="btn btn-success">
            <i class="fas fa-plus"></i> 添加新猫咪
        </a>
    </div>

    <table class="table table-striped table-hover">
        <thead class="thead-dark">
            <tr>
                <th>ID</th>
                <th>昵称</th>
                <th>月龄</th>
                <th>性别</th>
                <th>状态</th>
                <th>场所</th>
                <th>描述</th>
            </tr>
        </thead>
        <tbody>
            {% for cat in cats %}
            <tr>
                <td>{{ cat.catid }}</td>
                <td>{{ cat.cname }}</td>
                <td>{{ cat.month }}</td>
                <td>{{ cat.cgender }}</td>
                <td>{{ cat.status }}</td>
                <td>{{ cat.siteid }}</td>
                <td>{{ cat.description }}</td>
                <td>
                    <a href="{% url 'cat_update' cat.catid %}" class="btn btn-sm btn-primary">
                        <i class="fas fa-edit"></i> 编辑
                    </a>
                    <a href="{% url 'cat_delete' cat.catid %}" class="btn btn-sm btn-danger">
                        <i class="fas fa-trash"></i> 删除
                    </a>
                </td>
            </tr>
            {% empty %}
            <tr>
                <td colspan="7" class="text-center">暂无猫咪信息</td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>
{% endblock %}